import React from 'react';
import PropTypes from 'prop-types';
import { Form, Input } from 'antd';
import Line from './Line';

const { Item } = Form;
const { TextArea } = Input;

// 前直属上级确认申请
const GroupCeo = ({ form, isEdit, relatedBusinessObject }) => {
    const { getFieldDecorator } = form;
    const { suggestionGroupCeo } = relatedBusinessObject;
    const editItem = () =>
        getFieldDecorator('suggestionGroupCeo', {
            initialValue: suggestionGroupCeo,
            rules: [
                {
                    max: 200,
                    message: '0-200个字符'
                }
            ]
        })(<TextArea placeholder="请输入" rows={4} />);
    return (
        <div>
            <Line />
            <h3>集团CEO确认</h3>
            <Item label="意见或建议" help={isEdit && '0-200个字符'}>
                {isEdit ? editItem() : suggestionGroupCeo || '无'}
            </Item>
        </div>
    );
};

GroupCeo.propTypes = {
    isEdit: PropTypes.bool.isRequired,
    form: PropTypes.object.isRequired,
    relatedBusinessObject: PropTypes.object.isRequired
};

export default GroupCeo;
